package com.llkj.contractmanagement.contractmanagement.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.llkj.contractmanagement.R;
import com.llkj.contractmanagement.model.SystemMessageBean;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * author: dong.yj
 * created on: 2016/8/17 11:37
 * description:系统通知界面数据适配器
 */
public class SystemMessageDetailsAdapter extends CommonBaseAdapter<SystemMessageDetailsAdapter.ViewHolder,SystemMessageBean.XxlistBean> {


    public SystemMessageDetailsAdapter(Context context, List<SystemMessageBean.XxlistBean> list) {
        super(context, list);
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int position) {
        return new ViewHolder(inflate(R.layout.lv_system_message_details_item, null));
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        SystemMessageBean.XxlistBean xxlistBean = mList.get(position);
        if (!TextUtils.isEmpty(xxlistBean.getContent())) {
            holder.tvContent.setText(xxlistBean.getContent());
        }
        holder.tvTime.setText(xxlistBean.getAddtime());
    }

    static class ViewHolder extends CommonBaseAdapter.ViewHolder {

        @Bind(R.id.iv_message_details_photo)
        ImageView ivPhoto;
        @Bind(R.id.tv_message_details_time)
        TextView tvTime;
        @Bind(R.id.tv_message_details_content)
        TextView tvContent;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(view);
        }
    }
}
